import request from '@/utils/request'

// 查询报警日志列表
export function listAlarmLogs(query) {
  return request({
    url: '/firewaring/transmitter/logs',
    method: 'get',
    params: query
  })
}

// 查询设备信息
export function getDeviceInfo(deviceId) {
  return request({
    url: '/firewaring/device/manage/' + deviceId,
    method: 'get'
  })
}

// 查询设备列表
export function listDevices(query) {
  return request({
    url: '/firewaring/device/manage',
    method: 'get',
    params: query
  })
}

// 取消防火报警
export function cancelFireAlarm(data) {
  return request({
    url: '/firewarning/alarm/cancel',
    method: 'post',
    data: data
  })
}

// 控制防火预警设备
export function controlFireWarningDevice(data) {
  return request({
    url: '/firewarning/device/control',
    method: 'post',
    data: data
  })
}

// 获取防火预警设备参数设置
export function getFireWarningParameters() {
  return request({
    url: '/firewarning/device/parameters',
    method: 'get'
  })
}

// 保存防火预警设备参数设置
export function saveFireWarningParameters(data) {
  return request({
    url: '/firewarning/device/parameters',
    method: 'post',
    data: data
  })
}

// 获取防火预警设备状态
export function getFireWarningDeviceStatus(deviceId) {
  return request({
    url: '/firewarning/device/status',
    method: 'get',
    params: { deviceId }
  })
}

// 清空防火预警报警日志
export function clearFireWarningLogs() {
  return request({
    url: '/firewarning/logs/clear',
    method: 'delete'
  })
}

// 导出防火预警报警日志
export function exportFireWarningLogs(query) {
  return request({
    url: '/firewarning/logs/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 更新设备工作模式
export function updateFireWarningWorkMode(data) {
  return request({
    url: '/firewarning/device/workmode',
    method: 'put',
    data: data
  })
}